package lab02.test26;

import java.util.Scanner;

public class ExceptionTest {
    public static void main(String[] args) {

                int num = 0;
                Scanner scanner = new Scanner(System.in);
                System.out.print("请输入被除数:");
                int num1 = scanner.nextInt();
                System.out.print("请输入除数:");
                int num2 = scanner.nextInt();

                try{
                    num = num1 / num2;
                    System.out.println(num);
                }catch(ArithmeticException e) {
                    System.out.println("错误：除数不能为0！");
                }finally {
                    System.out.println("此次运行结束！");
                }

    }
}
